%section.ldap-group-links
  = gitlab_ui_form_for [group, LdapGroupLink.new] do |f|
    .form-holder
      .form-group.row
        .col-sm-2.col-form-label
          = f.label :cn, s_("LDAP|LDAP server")
        .col-sm-10
          = f.select :provider, ldap_server_select_options, {}, class: 'form-control'

      - if ::License.feature_available?(:ldap_group_sync_filter)
        .form-group.row
          .col-sm-2.col-form-label
            = f.label :cn, s_("LDAP|Sync method")
          %fieldset.col-sm-10
            .gl-form-radio.custom-control.custom-radio
              = radio_button_tag :sync_method, :group, true, class: 'custom-control-input', data: { qa_selector: 'ldap_sync_group_radio' }
              = label_tag :sync_method_group, class: 'custom-control-label' do
                = s_("LDAP|LDAP group cn")
            .gl-form-radio.custom-control.custom-radio
              = radio_button_tag :sync_method, :filter, false, class: 'custom-control-input', data: { qa_selector: 'ldap_sync_user_filter_radio' }
              = label_tag :sync_method_filter, class: 'custom-control-label' do
                = s_("LDAP|LDAP user filter")

      .form-group.row.cn-link
        .col-sm-2.col-form-label
          = f.label :cn, s_("LDAP|LDAP group cn")
        .col-sm-10{ data: { qa_selector: 'ldap_group_field' } }
          #js-ldap-groups-select
          .form-text.text-muted
            Synchronize #{group.name}'s members with this LDAP group.
            %br
            If you select an LDAP group you do not belong to you will lose ownership of #{group.name}.

      - if ::License.feature_available?(:ldap_group_sync_filter)
        .form-group.row.filter-link
          .col-sm-2.col-form-label
            = f.label :filter, s_("LDAP|LDAP user filter")
          .col-sm-10
            = f.text_field :filter, placeholder: 'Ex. (&(objectCategory=person)(objectClass=developer))', class: 'form-control xxlarge input-mn-300', data: { qa_selector: 'ldap_user_filter_field' }
            .form-text.text-muted
              - ldap_link = link_to 'LDAP Search Filter Syntax', 'https://msdn.microsoft.com/en-us/library/aa746475(v=vs.85).aspx'
              This query must use valid #{ldap_link}. Synchronize #{group.name}'s members with this LDAP user filter.
              %br
              If you do not belong to this LDAP user filter you will lose ownership of #{group.name}.

      .form-group.row
        .col-sm-2.col-form-label
          = f.label :group_access, s_("LDAP|LDAP access")
        .col-sm-10
          = f.select :group_access, options_for_select(GroupMember.access_level_roles), {}, class: 'form-control'
          .form-text.text-muted
            Default, minimum permission level for LDAP group members of #{group.name}.
            %br
            You can manage permission levels for individual group members in the Members tab.

    .form-actions.gl-mb-5
      = f.submit s_("LDAP|Add synchronization"), pajamas_button: true, data: { qa_selector: 'add_sync_button' }
